package com.navajo.components;

import java.util.ArrayList;
import java.util.List;

import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.NativeButton;
import com.vaadin.ui.VerticalLayout;

public class SideBarMenuLayout extends CustomComponent {

	private VerticalLayout layout = new VerticalLayout();

	public SideBarMenuLayout() {
		super();

		setCompositionRoot(layout);

	}

	private List<NativeButton> buttons = new ArrayList<NativeButton>();

	public void addButton(final NativeButton button) {

		buttons.add(button);
		
		layout.addComponent(button);

		button.addClickListener(new ClickListener() {

			@Override
			public void buttonClick(ClickEvent event) {

				for (NativeButton b : buttons) {
					b.removeStyleName("selected");

				}

				button.addStyleName("selected");

			}
		});

	}

}
